package com.kuangstudy.controller.params;

import com.kuangstudy.utils.fn.asserts.Vsserts;
import com.kuangstudy.vo.ParamsVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * Description:
 * Author: yykk Administrator
 * Version: 1.0
 * Create Date Time: 2021/12/13 20:17.
 * Update Date Time:
 *
 * @see
 */

@RestController
@Slf4j
public class PararmeterController2 {


    @PostMapping("/param7/{id}/{name}/{age}")
    public String param7(@PathVariable("id") String id,
                         @PathVariable("name") String name,
                         @PathVariable("age") String age, HttpServletRequest request) {

        System.out.println(request.getParameter("id"));
        System.out.println(request.getParameter("name"));
        System.out.println(request.getParameter("age"));
        log.info("你传递的参数是：id:{},name:{},age：{}", id, name, age);
        return "success";
    }

    @PostMapping("/param9/{id}/{name}/{age}")
    public String param9(@PathVariable("id") String userid,
                         @PathVariable("name") String username,
                         @PathVariable("age") String userage) {
        log.info("你传递的参数是：id:{},name:{},age：{}", userid
                , username, userage);
        return "success";
    }


    @PostMapping("/param8/{id}/{name}/{age}")
    public String param8(@PathVariable String id,
                         @PathVariable String name,
                         @PathVariable String age) {
        log.info("你传递的参数是：id:{},name:{},age：{}", id, name, age);
        return "success";
    }

    @PostMapping("/param10/{id}")
    public String param10(@PathVariable String id,
                          String name,
                          String age) {
        log.info("你传递的参数是：id:{},name:{},age：{}", id, name, age);
        return "success";
    }

    @PostMapping("/param11/{id}")
    public String param11(@PathVariable String id,
                          @RequestBody ParamsVo paramsVo) {
        log.info("你传递的参数是：id:{},name:{},age：{}", id, paramsVo);
        return "success";
    }
}
